15 Running post-install PowerShell scripts

MyID provides trigger points that allow you to customize your MyID server installation procedure by running post-install PowerShell scripts.

Note: These PowerShell scripts require PowerShell 5. You can use the following PowerShell command to confirm the installed version:

Get-Host | Select-Object Version

The MyID Installation Assistant can run a PowerShell script automatically at the end of the installation procedure for the following operations:

15.1 Adding scripts to the installation media

To configure your MyID server installation program to run a PowerShell script automatically:

  1. Locate the folder called PostInstallScripts in the Installer folder that contains the MyID server installation program:

  2. In the PostInstallScripts folder, the following scripts are provided by default:

    • Install.ps1 – run automatically at the end of an installation procedure.
    • Uninstall.ps1 – run automatically at the end of an uninstallation procedure.

    Several PowerShell modules (.psm1 files) are provided to support the scripts.

    These scripts run automatically at the end of the installation or uninstallation, and configure your system with custom components, web files, translation dictionaries, and database scripts located in the following folders:

    • Configuration

    • ConfigurationDBScripts

    By default, these folders are empty; if you want to provide your own custom MyID configuration components, files, and database scripts, contact customer support quoting reference SUP-351.

    Alternatively, you can replace these PowerShell scripts with your own scripts.

    Note: If Intercede subsequently provides you with configuration updates, these will also use the same filenames – make sure that you merge the changes; if you overwrite the files, you may lose important configuration tasks.

When the provided scripts are run on installation or uninstallation, a log file named ConfigurationInstall.log is generated.

15.2 Configuring the provided scripts for non-standard SQL port

When the scripts run, they obtain their connection information from the UDL database connection file. If you have set up a non-standard SQL port, the port number is normally included in the UDL connection.

However, you may require additional configuration if your application and database tiers are on the same physical server; if you have the Shared Memory protocol enabled for SQL Server, the installation program uses that protocol instead of TCP/IP, which means that the UDL file does not contain the TCP/IP connection details, including the port. If you are using the standard port, the PowerShell scripts will connect correctly; however, if you are using a non-standard SQL port, you must edit the Sql.psm1 module to set the $SQLPortTCP variable to the appropriate value.

15.3 Determining which components are installed

You may want to carry out different operations based on which MyID components are installed; for example, you may want to run a database script if the server is being used to install the database components, or to modify web files if the installation is running on the web server.

To do this, you can check the MyID registry in your PowerShell script. For example:

Copy
$TiersRoot = "HKLM:\SOFTWARE\Intercede\Edefice\Installation"
$AppTier    = Test-Path -Path (Join-Path -Path $TiersRoot -ChildPath "ApplicationTier")
$WebTier    = Test-Path -Path (Join-Path -Path $TiersRoot -ChildPath "WebTier")
$DBTier     = Test-Path -Path (Join-Path -Path $TiersRoot -ChildPath "DatabaseTier")
$ArchDBTier = Test-Path -Path (Join-Path -Path $TiersRoot -ChildPath "ArchiveDatabaseTier")
$AuthTier   = Test-Path -Path (Join-Path -Path $TiersRoot -ChildPath "ExternalAuthTier")

Write-Output "Checking which MyID server components are installed..."

if ($AppTier)
{
Write-Output "Application server components installed."
}

if ($WebTier)
{
Write-Output "Web server components installed."
}

if ($DBTier)
{
Write-Output "Database server components installed."
}

if ($ArchDBTier)
{
Write-Output "Archive database components installed."
}

if ($AuthTier)
{
Write-Output "External Authentication Server components installed."
}


if (-Not ($AppTier -or $WebTier -or $DBTier -or $ArchDBTier -or $AuthTier))
{
Write-Output "No MyID server components installed."
}